package org.geektimes.projects.user.web.controller;

import org.geektime.web.mvc.controller.RestController;
import org.geektime.web.mvc.model.Data;
import org.geektimes.projects.user.domain.User;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.core.MediaType;
import java.util.logging.Logger;

@Path("/json")
public class TestJSONController implements RestController {

    private Logger logger = Logger.getLogger(this.getClass().getName());


    @POST
    @Override
    @Path("/test")
    @Consumes(MediaType.APPLICATION_JSON)
    public Data execute(HttpServletRequest request, HttpServletResponse response) {
        User user = new User();
        user.setName("teset");
        user.setPassword("*****");
        user.setEmail("123@test.com");
        Data<User> data = new Data(user);
        return data;
    }
}
